package com.camel.base.controller;

import com.camel.base.model.ZsOption;
import com.camel.base.service.ZsOptionService;
import com.camel.core.controller.BaseCommonController;
import com.camel.core.exceptions.CustomException;
import com.camel.core.service.BaseCommonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.Serializable;

/**
 * @author camel
 */
@RestController
@RequestMapping("zsOption")
public class ZsOptionController extends BaseCommonController<ZsOption> {

    @Autowired
    private ZsOptionService<ZsOption> service;

    @Override
    public boolean deleteAble(Serializable id) {
        ZsOption byId = service.getById(id);
        if (ObjectUtils.isEmpty(byId)) {
            throw new CustomException("删除失败: " + getMouduleName() + "不存在");
        }
        return true;
    }

    @Override
    public BaseCommonService<ZsOption> getiService() {
        return service;
    }

    @Override
    public String getMouduleName() {
        return "选项";
    }
}
